using System.Globalization;
using Newtonsoft.Json.Converters;

namespace Crux.Core.Websockets;
/// <summary>
/// WebsocketConstants
/// </summary>
public class WebsocketConstants
{
    /// <summary>
    /// 默认序列化setting
    /// </summary>
    /// <value></value>
    public static JsonSerializerSettings SerializerSettings = new JsonSerializerSettings
    {
        Error = (sender, e) => e.ErrorContext.Handled = true,
        MaxDepth = 128,
        Culture = CultureInfo.InvariantCulture,
        ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
        NullValueHandling = NullValueHandling.Ignore,
        MissingMemberHandling = MissingMemberHandling.Ignore,
    };
    static WebsocketConstants()
    {
        SerializerSettings.Converters.Add(new StringEnumConverter());
    }
    /// <summary>
    ///
    /// </summary>
    public static readonly string[] IgnoreMethods = new string[] {
        "Dispose",
        "OnConnectedAsync",
        "OnDisconnectedAsync",
        "HandleBinaryMessage",
        "GetType",
        "ToString",
        "Equals",
        "GetHashCode"
    };

    /// <summary>
    ///
    /// </summary>
    public const string GetterPrefix = "get_";
    /// <summary>
    ///
    /// </summary>
    public const string SetterPrefix = "set_";
}